package com.ntschy.bt.entity.mapstruct;

import com.ntschy.bt.entity.dataobject.BtQuestion;
import com.ntschy.bt.entity.dataobject.BtQuestionInfo;
import com.ntschy.bt.entity.dto.BtQuestionDTO;
import com.ntschy.bt.entity.dto.BtQuestionInfoDTO;
import com.ntschy.bt.entity.dto.BtQuestionPageDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @author cm
 */
@Mapper(componentModel = "spring")
public interface BtQuestionMapstruct {

    /**
     * @param questionDTO 前端传来的数据对象
     * @return
     * @description 问卷转换 BtQuestionDTO 转 BtQuestion
     * @author
     * @date
     */
    @Mappings({
            @Mapping(target = "id", source = "id"),
            @Mapping(target = "title", source = "title"),
            @Mapping(target = "startTime", source = "startTime"),
            @Mapping(target = "endTime", source = "endTime"),
            @Mapping(target = "createUserId", source = "createUserId"),
            @Mapping(target = "createUserName", source = "createUserName"),
            @Mapping(target = "createTime", source = "createTime"),
            @Mapping(target = "status", source = "status"),
            @Mapping(target = "publishUserId", source = "publishUserId"),
            @Mapping(target = "publishUserName", source = "publishUserName"),
            @Mapping(target = "publishTime", source = "publishTime"),
            @Mapping(target = "delFlag", source = "delFlag"),
            @Mapping(target = "close", source = "close"),
    })
    BtQuestion questionMapStruct(BtQuestionDTO questionDTO);

    /**
     * @param questionInfoDTO
     * @return
     * @description 问卷转换 BtQuestionInfoDTO 转 BtQuestionInfo
     * @author
     * @date
     */
    @Mappings({
            @Mapping(target = "id", source = "id"),
            @Mapping(target = "objectID", source = "objectID"),
            @Mapping(target = "mainTitle", source = "mainTitle"),
            @Mapping(target = "displayNumber", source = "displayNumber"),
            @Mapping(target = "requiredQue", source = "requiredQue"),
            @Mapping(target = "queType", source = "queType"),
    })
    BtQuestionInfo questionInfoMapStruct(BtQuestionInfoDTO questionInfoDTO);

    /**
     * @param question 前端传来的数据对象
     * @return
     * @description 问卷转换 BtQuestion 转 BtQuestionDTO
     * @author
     * @date
     */
    @Mappings({
            @Mapping(target = "id", source = "id"),
            @Mapping(target = "title", source = "title"),
            @Mapping(target = "startTime", source = "startTime"),
            @Mapping(target = "endTime", source = "endTime"),
            @Mapping(target = "createUserId", source = "createUserId"),
            @Mapping(target = "createUserName", source = "createUserName"),
            @Mapping(target = "createTime", source = "createTime"),
            @Mapping(target = "status", source = "status"),
            @Mapping(target = "publishUserId", source = "publishUserId"),
            @Mapping(target = "publishUserName", source = "publishUserName"),
            @Mapping(target = "publishTime", source = "publishTime"),
            @Mapping(target = "delFlag", source = "delFlag"),
            @Mapping(target = "close", source = "close"),
    })
    BtQuestionDTO questionDTOMapStruct(BtQuestion question);

    /**
     * @param questionInfo
     * @return
     * @description 问卷转换 BtQuestionInfo 转 BtQuestionInfoDTO
     * @author
     * @date
     */
    @Mappings({
            @Mapping(target = "id", source = "id"),
            @Mapping(target = "objectID", source = "objectID"),
            @Mapping(target = "mainTitle", source = "mainTitle"),
            @Mapping(target = "displayNumber", source = "displayNumber"),
            @Mapping(target = "requiredQue", source = "requiredQue"),
            @Mapping(target = "queType", source = "queType"),
    })
    BtQuestionInfoDTO questionInfoDTOMapStruct(BtQuestionInfo questionInfo);

    /**
     * @param questionPageDTO 前端传来的数据对象
     * @return
     * @description 问卷转换 BtQuestionPageDTO 转 BtQuestion
     * @author
     * @date
     */
    @Mappings({
            @Mapping(target = "title", source = "title"),
            @Mapping(target = "startTime", source = "startTime"),
            @Mapping(target = "endTime", source = "endTime"),
            @Mapping(target = "status", source = "status"),
            @Mapping(target = "delFlag", source = "delFlag"),
            @Mapping(target = "close", source = "close"),
    })
    BtQuestion questionMapStruct(BtQuestionPageDTO questionPageDTO);

}
